const Sequelize = require('sequelize');
const DB = require("../config/dbconfig");
const triendModel = require('./triend_tab');

const triendImgModel = DB.define('triend_img_tab', {
    triend_img_id: {
      type: Sequelize.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "动态图片表主键"
    },
    img: {
      type: Sequelize.STRING(15000),
      allowNull: true,
      comment: "图片url"
    },
    triend_id: {
      type: Sequelize.INTEGER,
      allowNull: true,
      comment: "动态表外键",
      references: {
        model: 'triend_tab',
        key: 'triend_id'
      }
    },
    is_delete:{
      type:Sequelize.INTEGER(2),
      comment:"是否删除"
    }
  }, {
    Sequelize,
    tableName: 'triend_img_tab',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "triend_img_id" },
        ]
      },
      {
        name: "triend_img",
        using: "BTREE",
        fields: [
          { name: "triend_id" },
        ]
      },
    ]
  });
module.exports = triendImgModel
